package com.android.tvservicer

import java.io.File
import java.io.FileInputStream
import java.io.IOException

/**
 * Created by mr.kong on 2017/9/25.
 */
class BoardDeviceUtils {
    companion object {
        fun getDeviceIdFromDisk(): String {
            val file = File("/system/etc/devices")
            var stream: FileInputStream? = null
            try {


                val bytes = ByteArray(1024)
                stream = FileInputStream(file)
                val count = stream.read(bytes)
                val boardDevice = String(bytes, 0, count)
                if (boardDevice != null) {
                    return boardDevice
                }
            } catch (e: IOException) {
                e.printStackTrace()
            } finally {
                if (stream != null) {
                    try {
                        stream.close()
                    } catch (e: IOException) {
                        e.printStackTrace()
                    }

                }
            }

            return ""
        }
    }

}